import axios from "axios";

export function api({ url, data, method, params }) {
  return new Promise((resolve, reject) => {
    axios({
      method,
      url,
      data,
      params,
      headers: {
        Authorization: JSON.parse(localStorage.getItem("token"))
        // token:localStorage.getItem("token")
      }
    })
      .then(da => {
        resolve(da);
      })
      .catch(error => {
        reject(error);
      });
  });
}
